# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=ftpmap
pkgver=52.cbeabbe
pkgrel=2
groups=('blackarch' 'blackarch-fingerprint' 'blackarch-scanner')
pkgdesc='Scans remote FTP servers to identify what software and what versions they are running.'
arch=('x86_64' 'aarch64')
url='http://wcoserver.googlecode.com/files/'
license=('GPL2')
makedepends=('git')
source=("git+https://github.com/Hypsurus/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  sed -ig 's|"../db/|"/usr/share/ftpmap/db/|' "src/$pkgname.c"
}

build() {
  cd $pkgname

  if [[ "$CARCH" == "i686" || "$CARCH" == "x86_64" ]];
  then
    ./configure --prefix=/usr
  else
    ./configure --prefix=/usr --build=arm
  fi

  make
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/share/$pkgname"

  make DESTDIR="$pkgdir" install

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" AUTHORS THANKS NEWS \
    README.md
  install -Dm 644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
}

